﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Xml.Serialization;

namespace SerializationGenerate
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            #region content
            //using (FileStream stream = File.Open("content.xml", FileMode.Create))
            //{
            //    ContentInfo config = new ContentInfo();
            //    XmlSerializer xmlserializer = new XmlSerializer(typeof (ContentInfo));
            //    xmlserializer.Serialize(stream, config);
            //    stream.Close();
            //    stream.Dispose();
            //}
            #endregion
            #region config

            List<ConfigInfo> list = new List<ConfigInfo>();
            using (FileStream stream = File.Open("config.xml", FileMode.Create))
            {
                ConfigInfo config = new ConfigInfo();
                config.Charset = "gbk";
                config.ConnString = "1";
                config.DocLastUpdate = "";
                config.Domain = "http";
                config.FilePath = "1";
                config.flag = "ff";
                config.ImageMaxWidth = 10;
                config.IndexUrl = "aa";
                config.IsActive = 1;
                config.LastUpdate = "20120202";
                config.MaxPage = 3;
                config.RepeatMax = 3;
                config.RuleFlag = "qidian";
                config.SecondRules = "1=17k";
                config.SleepBook = 10;
                config.SleepChapter = 1;
                config.SleepTimes = 10;
                config.Sort = 1;
                config.SourceFilePath = "";
                config.SourceFlag = "";
                config.TargetConnString = "127";
                config.TargetDomain = "http://8080";
                config.WebName = "webname";
                list.Add(config);
                XmlSerializer xmlserializer = new XmlSerializer(typeof(List<ConfigInfo>));
                xmlserializer.Serialize(stream, list);
                stream.Close();
                stream.Dispose();
            }
            #endregion
        }
    }
}